package com.happy.cat.project.system.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.happy.cat.project.system.domain.CatChannel;
import com.happy.cat.project.system.mapper.CatChannelMapper;
import com.happy.cat.project.system.service.ICatChannelService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 渠道管理Service业务层处理
 *
 * @author verne
 * @date 2020-08-22
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CatChannelServiceImpl extends ServiceImpl<CatChannelMapper, CatChannel> implements ICatChannelService {

    @Override
    public boolean banStatusByIds(List<Long> asList, int status) {
        return this.update().set("status", status).in("id", asList).update();
    }

    @Override
    public CatChannel getByUserId(Long userId) {
        return this.getOne(Wrappers.lambdaQuery(CatChannel.class).eq(CatChannel::getSysUserId, userId));
    }
}
